<html>
<head><meta charset="utf-8"><title>Dumping buffer representation from Rust-analyzer · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html">Dumping buffer representation from Rust-analyzer</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227559316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Dumping%20buffer%20representation%20from%20Rust-analyzer/near/227559316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Lingelbach <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html#227559316">(Feb 24 2021 at 07:37)</a>:</h4>
<p>Hi! I'm a contributor to neovim's language server client implementation. I'm implementing incremental sync for neovim, and was hoping to use rust-analyzer to test whether we are sending the correct ranges. I can't seem to find in which crate the actual handler for textDocument/didChange is found (tried searching the rust-analyzer org via GH search, rust-analyzer itself, and several crates).  I'd like to dump the internal representation of the buffer to a file on each change notification so that I can compare our client to what rust-analyzer believes we have sent.</p>



<a name="227560493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Dumping%20buffer%20representation%20from%20Rust-analyzer/near/227560493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html#227560493">(Feb 24 2021 at 07:50)</a>:</h4>
<p>You could add some logging to the console or to a file if that works for you</p>



<a name="227560616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Dumping%20buffer%20representation%20from%20Rust-analyzer/near/227560616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html#227560616">(Feb 24 2021 at 07:51)</a>:</h4>
<p>The changes are applied in this function <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/lsp_utils.rs#L92-L139">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/lsp_utils.rs#L92-L139</a></p>



<a name="227560892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Dumping%20buffer%20representation%20from%20Rust-analyzer/near/227560892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html#227560892">(Feb 24 2021 at 07:54)</a>:</h4>
<p>The entry point for <code>textDocument/didChange</code> is <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/main_loop.rs#L584-L605">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/main_loop.rs#L584-L605</a>, but there's not much happening besides <code>apply_document_changes</code></p>



<a name="227562003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Dumping%20buffer%20representation%20from%20Rust-analyzer/near/227562003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Lingelbach <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html#227562003">(Feb 24 2021 at 08:06)</a>:</h4>
<p>This is exactly what I was looking for! Thank you. What I did with julia language server was dump to a file, so I think that's what I'll do here. Unfortunately they don't yet support incremental sync.</p>



<a name="227562696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Dumping%20buffer%20representation%20from%20Rust-analyzer/near/227562696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Dumping.20buffer.20representation.20from.20Rust-analyzer.html#227562696">(Feb 24 2021 at 08:14)</a>:</h4>
<p>Yup. Feel free to ask if you need more help (even if t it's e.g. writing to a file or compiling the code)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>